package com.hb.core.base;

import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @description: 排序字段缓存
 * @projectName: zhb-frame-build
 * @author: zhouhaizhi
 * @createTime: 2021/8/16 11:41
 * @version:1.0
 */
public class AllowOrderFieldCache {

    private static Map<String, Set<String>> cache = new ConcurrentHashMap<>();

    /*
        查询是否存在某个类的排序字段缓存
     */
    public static Boolean containClass(String className) {
        return cache.containsKey(className);
    }

    /*
        获取某个类的排序字段缓存
     */
    public static Set<String> getFieldCacheByClass(Class<?> clazz) {
        return cache.get(clazz.getSimpleName());
    }

    /*
        设置某个类的排序字段缓存
     */
    public static void setCacheOnClass(Class<?> clazz, Set<String> fieldSet) {
        cache.put(clazz.getSimpleName(), fieldSet);
    }

}
